WHILE

WHILE

am 19.07.2009 15:54:28 von Emiliano Boragina

------=_NextPart_000_0001_01CA085F.4B9B6170
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello everyone=85

=20

First, I thank you all for the help on the past week.

I could do the finder... thank you very much.

=20

Now... I must print images from the product. But the data about the =
product
is in a table and the pictures are in other table.

The picture table has 12 columns, the first two are ID and CODE, the =
rest of
them are picture1, picture2, picture3... picture10.

Can be not always the product has all ten pictures, can be three, one, =
etc.

I dont know how to use WHILE to print pictures without print ID and CODE
columns.

=20

This my code:

=20


$ID =3D $_GET['id_PROD'];

$sql =3D "SELECT * FROM picture WHERE id =3D '$ID'";

$result =3Dmysql_query($sql,$conn);

=20

while($row_FOTOS=3Dmysql_fetch_row($result))

{

echo " height=3D'384' />";

}

?>

=20

Thanks

=20

+ =
_
// Emiliano Boragina _
// Dise=F1o & Comunicaci=F3n //////////////////
+ =
_
// emiliano.boragina@gmail.com /
// 15 40 58 60 02 ///////////////////////////
+ =
_

=20


------=_NextPart_000_0001_01CA085F.4B9B6170--

Re: WHILE

am 19.07.2009 17:13:04 von Yves Sucaet

Why don't you use mysql_fetch_assoc() instead? You can address your fields
directly, as in:


while($row_FOTOS=mysql_fetch_assoc($result))
{
echo " height='384' />";
echo " height='384' />";
}

Alternatively, you can specify which fields you want in your SQL statement:

$sql = "SELECT picture1, picture2 FROM picture WHERE id = '$ID'";
$result =mysql_query($sql,$conn);
while($row_FOTOS=mysql_fetch_array($result))
{
echo "";
// picture1
echo "";
// picture2
}



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php